﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes {

    public class TrainCrossing extends Road {

        public var m_orientation_X:Boolean = false;

        public function TrainCrossing(_arg1:String=null){
            super(_arg1);
        }
        override public function isSellable():Boolean{
            return (false);
        }
        override public function canBeDragged():Boolean{
            return (false);
        }
        override protected function getCurrentImage():ItemImageInstance{
            if (m_currentRule){
                if (m_currentRule.tile == "straightaway_e"){
                    return (m_item.getCachedImage("railroad_crossing_se"));
                };
                if (m_currentRule.tile == "straightaway_n"){
                    return (m_item.getCachedImage("railroad_crossing_sw"));
                };
            };
            return (null);
        }
        override protected function updateAdjacent():void{
            var _local1:int;
            super.updateAdjacent();
            var _local2:int;
            while (_local2 < m_adjacent.length) {
                _local1 = m_adjacent[_local2];
                if (((((this.m_orientation_X) && ((((_local1 == UP)) || ((_local1 == DOWN)))))) || (((!(this.m_orientation_X)) && ((((_local1 == LEFT)) || ((_local1 == RIGHT)))))))){
                    m_adjacent.splice(_local2, 1);
                    _local2--;
                    m_adjacentRoads[_local1] = null;
                };
                _local2++;
            };
            for each (_local1 in m_adjacentPartial) {
                m_adjacentRoads[_local1] = null;
            };
            m_adjacentPartial = [];
            for each (_local1 in m_adjacentStretch) {
                m_adjacentRoads[_local1] = null;
            };
            m_adjacentStretch = [];
            for each (_local1 in m_adjacentTight) {
                m_adjacentRoads[_local1] = null;
            };
            m_adjacentTight = [];
            if (m_adjacent.length != 2){
                m_adjacentRoads = [];
                m_adjacent = [];
            };
        }

    }
}//package Classes 
